home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / galpanic.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  10KB  |  273 lines

  1. /***************************************************************************
  2.  
  3. The current ROM set is strange because two ROMs overlap two others replacing
  4. the program.
  5.  
  6. It's definitely a Kaneko boardset, but it could very well be they converted
  7. some other game to run Gals Panic, because there's some ROMs piggybacked
  8. on top of each other and some ROMs on a daughterboard plugged into smaller
  9. sized ROM sockets. It's not a pirate version. The piggybacked ROMs even have
  10. Kaneko stickers. The silkscreen on the board says PAMERA-4.
  11.  
  12. There is at least another version of the Gals Panic board. It's single board,
  13. so no daughterboard. There are only 4 IC's socketed, the rest is soldered to
  14. the board, and no piggybacked ROMs. Board number is MDK 321 V-0    EXPRO-02
  15.  
  16. ***************************************************************************/
  17.  
  18. #include "driver.h"
  19. #include "vidhrdw/generic.h"
  20.  
  21.  
  22.  
  23. extern unsigned char *galpanic_bgvideoram,*galpanic_fgvideoram;
  24. extern size_t galpanic_fgvideoram_size;
  25.  
  26. void galpanic_init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom);
  27. READ_HANDLER( galpanic_bgvideoram_r );
  28. WRITE_HANDLER( galpanic_bgvideoram_w );
  29. READ_HANDLER( galpanic_fgvideoram_r );
  30. WRITE_HANDLER( galpanic_fgvideoram_w );
  31. READ_HANDLER( galpanic_paletteram_r );
  32. WRITE_HANDLER( galpanic_paletteram_w );
  33. READ_HANDLER( galpanic_spriteram_r );
  34. WRITE_HANDLER( galpanic_spriteram_w );
  35. void galpanic_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  36.  
  37.  
  38.  
  39.  
  40. int galpanic_interrupt(void)
  41. {
  42.     /* IRQ 3 drives the game, IRQ 5 updates the palette */
  43.     if (cpu_getiloops() != 0) return 5;
  44.     else return 3;
  45. }
  46.  
  47. WRITE_HANDLER( galpanic_6295_bankswitch_w )
  48. {
  49.     static unsigned char bank[2];
  50.     unsigned char *RAM = memory_region(REGION_SOUND1);
  51.  
  52.  
  53.     COMBINE_WORD_MEM(bank,data);
  54.  
  55.     memcpy(&RAM[0x30000],&RAM[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
  56. }
  57.  
  58.  
  59.  
  60. static struct MemoryReadAddress readmem[] =
  61. {
  62.     { 0x000000, 0x3fffff, MRA_ROM },
  63.     { 0x400000, 0x400001, OKIM6295_status_0_r },
  64.     { 0x500000, 0x51ffff, galpanic_fgvideoram_r },
  65.     { 0x520000, 0x53ffff, galpanic_bgvideoram_r },
  66.     { 0x600000, 0x6007ff, galpanic_paletteram_r },
  67.     { 0x700000, 0x7047ff, galpanic_spriteram_r },
  68.     { 0x800000, 0x800001, input_port_0_r },
  69.     { 0x800002, 0x800003, input_port_1_r },
  70.     { 0x800004, 0x800005, input_port_2_r },
  71.     { -1 }  /* end of table */
  72. };
  73.  
  74. static struct MemoryWriteAddress writemem[] =
  75. {
  76.     { 0x000000, 0x3fffff, MWA_ROM },
  77.     { 0x400000, 0x400001, OKIM6295_data_0_w },
  78.     { 0x500000, 0x51ffff, galpanic_fgvideoram_w, &galpanic_fgvideoram, &galpanic_fgvideoram_size },
  79.     { 0x520000, 0x53ffff, galpanic_bgvideoram_w, &galpanic_bgvideoram },    /* + work RAM */
  80.     { 0x600000, 0x6007ff, galpanic_paletteram_w, &paletteram },    /* 1024 colors, but only 512 seem to be used */
  81.     { 0x700000, 0x7047ff, galpanic_spriteram_w, &spriteram, &spriteram_size },
  82.     { 0x900000, 0x900001, galpanic_6295_bankswitch_w },
  83.     { 0xa00000, 0xa00001, MWA_NOP },    /* ??? */
  84.     { 0xb00000, 0xb00001, MWA_NOP },    /* ??? */
  85.     { 0xc00000, 0xc00001, MWA_NOP },    /* ??? */
  86.     { -1 }  /* end of table */
  87. };
  88.  
  89.  
  90.  
  91. INPUT_PORTS_START( galpanic )
  92.     PORT_START
  93.     PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
  94.     PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
  95.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  96.     PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )    /* flip screen? */
  97.     PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
  98.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  99.     PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
  100.     PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )    /* might affect coinage according to manual, */
  101.     PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )        /* but settings below don't match */
  102.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  103.     PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) )
  104.     PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
  105.     PORT_DIPSETTING(      0x0010, DEF_STR( 3C_1C ) )
  106.     PORT_DIPSETTING(      0x0020, DEF_STR( 2C_1C ) )
  107.     PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
  108.     PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) )
  109.     PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_2C ) )
  110.     PORT_DIPSETTING(      0x0080, DEF_STR( 1C_3C ) )
  111.     PORT_DIPSETTING(      0x0040, DEF_STR( 1C_4C ) )
  112.     PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
  113.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  114.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  115.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  116.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  117.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 )
  118.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )// BUTTON2 ) used in test mode
  119.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  120.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  121.  
  122.     PORT_START
  123.     PORT_DIPNAME( 0x0003, 0x0003, "Difficulty?" )
  124.     PORT_DIPSETTING(      0x0002, "Easy?" )
  125.     PORT_DIPSETTING(      0x0003, "Normal?" )
  126.     PORT_DIPSETTING(      0x0001, "Hard?" )
  127.     PORT_DIPSETTING(      0x0000, "Hardest?" )
  128.     PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
  129.     PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
  130.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  131.     PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
  132.     PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
  133.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  134.     PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) )
  135.     PORT_DIPSETTING(      0x0010, "2" )
  136.     PORT_DIPSETTING(      0x0030, "3" )
  137.     PORT_DIPSETTING(      0x0020, "4" )
  138.     PORT_DIPSETTING(      0x0000, "5" )
  139.     PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )    /* manual says demo sounds but has no effect */
  140.     PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
  141.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  142.     PORT_DIPNAME( 0x0080, 0x0080, "Test Mode" )
  143.     PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
  144.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  145.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
  146.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
  147.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
  148.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  149.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  150.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )//BUTTON2 | IPF_COCKTAIL )
  151.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  152.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  153.  
  154.     PORT_START
  155.     PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
  156.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
  157.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
  158.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 )
  159.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_COIN2 )
  160.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  161.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_TILT )
  162.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN3 )
  163.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  164. INPUT_PORTS_END
  165.  
  166.  
  167.  
  168. static struct GfxLayout spritelayout =
  169. {
  170.     16,16,    /* 16*16 sprites */
  171.     8192,    /* 8192 sprites */
  172.     4,    /* 4 bits per pixel */
  173.     { 0, 1, 2, 3 },
  174.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
  175.             64*4, 65*4, 66*4, 67*4, 68*4, 69*4, 70*4, 71*4 },
  176.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  177.             16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
  178.     128*8    /* every sprite takes 128 consecutive bytes */
  179. };
  180.  
  181. static struct GfxDecodeInfo gfxdecodeinfo[] =
  182. {
  183.     { REGION_GFX1, 0, &spritelayout,  256, 16 },
  184.     { -1 } /* end of array */
  185. };
  186.  
  187.  
  188.  
  189. static struct OKIM6295interface okim6295_interface =
  190. {
  191.     1,                  /* 1 chip */
  192.     { 12000 },          /* 12000Hz frequency */
  193.     { REGION_SOUND1 },  /* memory region */
  194.     { 100 }
  195. };
  196.  
  197.  
  198.  
  199. static struct MachineDriver machine_driver_galpanic =
  200. {
  201.     /* basic machine hardware */
  202.     {
  203.         {
  204.             CPU_M68000,
  205.             8000000,    /* 8 Mhz ??? */
  206.             readmem,writemem,0,0,
  207.             galpanic_interrupt,2
  208.         }
  209.     },
  210.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  211.     1,    /* single CPU, no need for interleaving */
  212.     0,
  213.  
  214.     /* video hardware */
  215.     256, 256, { 0, 256-1, 0, 224-1 },
  216.     gfxdecodeinfo,
  217.     1024 + 32768, 1024,
  218.     galpanic_init_palette,
  219.  
  220.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  221.     0,
  222.     generic_bitmapped_vh_start,
  223.     generic_bitmapped_vh_stop,
  224.     galpanic_vh_screenrefresh,
  225.  
  226.     /* sound hardware */
  227.     0,0,0,0,
  228.     {
  229.         {
  230.             SOUND_OKIM6295,
  231.             &okim6295_interface
  232.         }
  233.     }
  234. };
  235.  
  236.  
  237.  
  238. /***************************************************************************
  239.  
  240.   Game driver(s)
  241.  
  242. ***************************************************************************/
  243.  
  244. ROM_START( galpanic )
  245.     ROM_REGION( 0x400000, REGION_CPU1 )    /* 68000 code */
  246.     ROM_LOAD_EVEN( "pm110.4m2",    0x000000, 0x080000, 0xae6b17a8 )
  247.     ROM_LOAD_ODD ( "pm109.4m1",    0x000000, 0x080000, 0xb85d792d )
  248.     /* The above two ROMs contain valid 68000 code, but the game doesn't */
  249.     /* work. I think there might be a protection (addressed at e00000). */
  250.     /* The two following ROMs replace the code with a working version. */
  251.     ROM_LOAD_EVEN( "pm112.6",      0x000000, 0x020000, 0x7b972b58 )
  252.     ROM_LOAD_ODD ( "pm111.5",      0x000000, 0x020000, 0x4eb7298d )
  253.     ROM_LOAD_ODD ( "pm004e.8",     0x100000, 0x080000, 0xd3af52bc )
  254.     ROM_LOAD_EVEN( "pm005e.7",     0x100000, 0x080000, 0xd7ec650c )
  255.     ROM_LOAD_ODD ( "pm000e.15",    0x200000, 0x080000, 0x5d220f3f )
  256.     ROM_LOAD_EVEN( "pm001e.14",    0x200000, 0x080000, 0x90433eb1 )
  257.     ROM_LOAD_ODD ( "pm002e.17",    0x300000, 0x080000, 0x713ee898 )
  258.     ROM_LOAD_EVEN( "pm003e.16",    0x300000, 0x080000, 0x6bb060fd )
  259.  
  260.     ROM_REGION( 0x100000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  261.     ROM_LOAD( "pm006e.67",    0x000000, 0x100000, 0x57aec037 )
  262.  
  263.     ROM_REGION( 0x140000, REGION_SOUND1 )    /* 1024k for ADPCM samples - sound chip is OKIM6295 */
  264.     /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */
  265.     ROM_LOAD( "pm008e.l",     0x00000, 0x80000, 0xd9379ba8 )
  266.     ROM_RELOAD(               0x40000, 0x80000 )
  267.     ROM_LOAD( "pm007e.u",     0xc0000, 0x80000, 0xc7ed7950 )
  268. ROM_END
  269.  
  270.  
  271.  
  272. GAME( 1990, galpanic, 0, galpanic, galpanic, 0, ROT90_16BIT, "Kaneko", "Gals Panic" )
  273.